﻿CREATE PROCEDURE [dbo].[ETL_SP_GetDataSourceDetail]
	@DtSerId uniqueidentifier,
	@DtSourceId uniqueidentifier
AS
	SELECT DS.*,
	(select DT.Name from ETL_DtTable as DT
		inner join ETL_DtSourceMapping as DSM ON DSM.DtSerId = @DtSerId and DSM.DtSourceId = DS.Id and DT.Id = DSM.DtTableId) as MappingTable,
		DSM1.DtTableId as MappingTableId
	from ETL_DtSource as DS
		LEFT join ETL_DtSourceMapping as DSM1 ON DSM1.DtSourceId = DS.Id
	WHERE DS.DtSerId = @DtSerId and DS.Id = @DtSourceId
RETURN 0
